package com.example.shop_2304.login

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.alibaba.android.arouter.launcher.ARouter
import com.example.base.mvvm.BaseActivity
import com.example.shop_2304.R
import com.example.shop_2304.databinding.ActivityUserBinding

class UserActivity : BaseActivity<ActivityUserBinding,LoginViewModel>() {
    override fun initView() {
        viewModel.userInfo()

        //点击跳转到修改密码界面
        binding.btnToUpdate.setOnClickListener {
            ARouter.getInstance().build("/app/UpdateActivity").navigation()
        }
    }

    override fun initData() {
        viewModel.userInfoSuccess.observe(this){
            if(it.code==200){
              //用数据绑定的形式显示数据
                binding.info = it.data
            }
        }
    }

    override fun getViewModel(): Class<LoginViewModel>  = LoginViewModel::class.java

    override fun getLayout(): Int  = R.layout.activity_user

}